package com.qire.manhua.dal.converter;

import com.qire.antsbinder.dal.ParamsConverter;

import java.util.List;
import java.util.StringJoiner;

/**
 * 批量操作章节ID列表转换器
 */
public class BatchChapterIdsConverter implements ParamsConverter<String, List<String>> {
    @Override
    public String change(List<String> value) {
        StringJoiner joiner = new StringJoiner(",");

        for(String chapterId : value) {
            joiner.add(chapterId);
        }

        return joiner.toString();

//        StringBuilder chapterIdsBuilder = new StringBuilder(value.size());
//        for (String chapterId : value){
//            chapterIdsBuilder.append(chapterId).append(",");
//        }
//        int deleteIndex = chapterIdsBuilder.lastIndexOf(",");
//        if(deleteIndex>0)
//            chapterIdsBuilder.deleteCharAt(deleteIndex);
//        return chapterIdsBuilder.toString();
    }
}
